package example12;

public class Student {
private String name;
private String address;
private String[] courses;
private int[] grades;
private int numCourses;
private static final int MAX_COURSES=30;
public Student (String name, String address)
{
	this.name=name;
	this.address=address;
	courses=new String[MAX_COURSES];
	grades=new int[MAX_COURSES];
	numCourses=0;
}
public String getName()
{
	return name;
}
public String getAddress()
{
	return address;
}
public void setAddress (String address)
{
	this.address=address;
}
public String toString(){
	return name+"("+address+")";
}
public void addCourseGrade (String coures, int grade)
{
	courses[numCourses]=coures;
	grades[numCourses]=grade;
	++numCourses;
}
public void printGades()
{
	System.out.println(this);
	for (int i=0;i<numCourses;i++)
	{
		System.out.println(""+courses[i]+":"+grades[i]);
	}
	System.out.println();
}
public double getAverageGrade()
{
	int sum=0;
	for(int i=0;i<numCourses;i++)
	{
		sum+=grades[i];
	}
	return(double)sum/numCourses;
}
}
